package main

import (
	"fmt"
	"time"
)

type T = struct{}

func Tick(d time.Duration) <-chan T {
	c := make(chan T, 1)
	go func() {
		for {
			time.Sleep(d)
			select {
			case c <- T{}:
			default:
			}
		}
	}()

	return c
}

func main() {
	t := time.Now()
	//for range Tick(time.Second) {
	//	fmt.Println(time.Since(t))
	//}
	for range time.Tick(time.Second) {
		fmt.Println(time.Since(t))
	}
}
